package dao;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity
@NamedQueries({
	@NamedQuery(name="searchCityCode",query=" from City c where c.OID = :code"),
	@NamedQuery(name="searchCityName",query=" from City c where c.nmCity like :name")
})
public class City {
	@Id
	@GeneratedValue
	private int OID;
	private String nmCity;
	
	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	private Federation federation; 
	
	public int getOID() {
		return OID;
	}
	public void setOID(int oID) {
		OID = oID;
	}
	public String getNmCidade() {
		return nmCity;
	}
	public void setNmCidade(String nmCidade) {
		this.nmCity = nmCidade;
	}
	public Federation getFederation() {
		return federation;
	}
	public void setFederation(Federation federation) {
		this.federation = federation;
	}
	public String toString(){
		return this.nmCity;
	}
}
